﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DICOMViewer.Utility;
using Newtonsoft.Json;
using qiniu_class;

namespace DICOMViewer.Model
{
    public class LoginInfo
    {
        private  LoginInfo()
        {
            
        }
        public static LoginInfo Current { get; private set; }

        public static bool Parse(string jsonString)
        {
            try
            {
                Current = SerializeHelper.DeserializeWithJson<LoginInfo>(jsonString);
                return Current!=null;
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Format("发生错误，错误信息：{0}，错误原因：{1}。",e.Message,e.Source));
                return false;
            }
        }
        [JsonProperty(PropertyName = "id")]
        public string ID { get; set; }
        [JsonProperty(PropertyName = "uuid")]
        public string Uuid { get; set; }
        [JsonProperty(PropertyName = "token")]
        public string Token { get; set; }
        [JsonProperty(PropertyName = "area_name")]
        public string AreaName { get; set; }
        [JsonProperty(PropertyName = "city_name")]
        public string CityName { get; set; }
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }
        [JsonProperty(PropertyName = "province_name")]
        public string ProvinceName { get; set; }
        [JsonProperty(PropertyName = "hospital_name")]
        public string HospitalName { get; set; }

        private IQiniuConfig config;

        public IQiniuConfig Qiniuconfig
        {
            get { return config; }
            set { config = value; }
        }
    }
}
